<?php

namespace App\Http\Requests;

use App\Models\WeChat;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class WeChatRequest extends FormRequest
{

    public function rules()
    {
        return [
            'title' => ['required'],
            'introduce' => ['required'],
            'name' => ['required'],
            'qr' => ['required'],
            'type' => ['required'],
            'token' => ['required'],
            'wechat_id' => ['required'],
            'appid' => ['required', Rule::unique('we_chats')->ignore(request('wechat'))],
            'appsecret' => ['required'],
        ];
    }

    public function messages()
    {
        return [
            'title.required' => '公众号标题',
            'introduce.required' => '公众号介绍',
            'name.required' => '公众号名称',
            'qr.required' => '公众号二维码',
            'token.required' => '公众号token',
            'wechat_id.required' => '公众号微信id',
            'appid.required' => '公众号appid',
            'appsecret.required' => '公众号密钥',
        ];
    }
}
